package com.yuexun.beilunpatient.ui.consult.model.impl;

import com.yuexun.beilunpatient.ui.bean.BaseListEntity;
import com.yuexun.beilunpatient.ui.consult.api.ArticleApi;
import com.yuexun.beilunpatient.ui.consult.bean.NewsDetailBean;
import com.yuexun.beilunpatient.ui.consult.bean.NewsInfoBean;
import com.yuexun.beilunpatient.ui.consult.model.IArticleModel;
import com.yuexun.beilunpatient.utils.ApiUtil;

import java.util.Map;

import rx.Observable;

/**
 * Created by chenss on 2018/7/30 0030.
 */

public class ArticleModel implements IArticleModel {

    private ArticleApi api;

    //记录Log
//    private final Logger log = ProUtil.getLogger(LoginModel.class);

    public ArticleApi ApiInstance() {
        if (api != null) {
            return api;
        } else {
            return ApiUtil.getInstance().createRetrofitApi(ArticleApi.class);
        }
    }

    @Override
    public Observable<BaseListEntity<NewsInfoBean>> inquireArticlePageList(Map<String, String> praise) {
        api = ApiInstance();
        return api.inquireArticlePageList(praise);
    }

    @Override
    public Observable<BaseListEntity<NewsDetailBean>> inquireNewsDetailForIndex(Map<String, String> praise) {
        api = ApiInstance();
        return api.inquireNewsDetailForIndex(praise);
    }
}
